package name.matthewgreet.example9.form; import com.opensymphony.xwork2.TextProvider; import com.opensymphony.xwork2.interceptor.ValidationAware; import name.matthewgreet.strutscommons.annotation.IntegerConversion; import name.matthewgreet.strutscommons.annotation.IntegerRange; import name.matthewgreet.strutscommons.annotation.Required; import name.matthewgreet.strutscommons.form.AbstractFormattableForm; @SuppressWarnings("deprecation") public class RequiredScoreAutoConversionForm extends AbstractFormattableForm { private static final long serialVersionUID = 4546633634493518786L; @Required(message = "Score is required") @IntegerConversion(message = "Score must be a number between 1 and 10") @IntegerRange(min = 1, max = 10, message = "Score must be a number between 1 and 10") private int score; public RequiredScoreAutoConversionForm() { resetFields(); } @Override public void resetFields() { score = 0; } @Override public void doValidate(ValidationAware validationAware, TextProvider textProvider) { // Empty } public int getScore() { return score; } public void setScore(int score) { this.score = score; } }